package com.ms.service.module.analysis.async;

import java.util.ArrayList;

import com.ms.service.module.analysis.db.AnalysisDAO;
import com.ms.service.module.analysis.db.model.RealTimeAnalysisModelV2;
import com.xpec.c4.service.module.task.TaskAsyncCommand;

public class UpdateRealTimeAnalysisModelAsync extends TaskAsyncCommand {
	
	public static final int ALL = 0;
	public static final int MEMBER = 1;
	public static final int TOTAL_BET = 2;
	public static final int REAL_TIME_BET = 3;

	/**
	 * 更新的models
	 */
	private ArrayList<RealTimeAnalysisModelV2> updateModels = new ArrayList<RealTimeAnalysisModelV2>();
	
	/**
	 * 要更新的類型
	 */
	private int updateType;
	
	@Override
	public void asyncExecute() throws Exception {
		AnalysisDAO.updateRealTimeModels(updateType, updateModels);
	}

	@Override
	public void execute() throws Exception {
		
	}

	public void setUpdateType(int updateType){
		this.updateType = updateType;
	}
	
	public void addModel(RealTimeAnalysisModelV2 model){
		if(model != null){
			updateModels.add(model);
		}
	}
	
	public void addModels(ArrayList<RealTimeAnalysisModelV2> models){
		if(models != null){
			updateModels.addAll(models);			
		}
	}
	
}
